<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>两新党组织基本信息</title>
<link href="/djzx/css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/djzx/js/jquery-1.8.1.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/djzx/js/backPage/clientSideApp.js"></script>
<script language="javascript">

function goback(){
	window.location.href="/djzx/LXPartyAction!getPartyInfoListForPage.action";
}

function updateParty(){
	var timeKey = $.trim($('#timeKey').val());
	var name = $.trim($('#name').val());
	var address = $.trim($('#address').val());
	var type = $.trim($('#type').val());
	var workerNum = $.trim($('#workerNum').val());
	var leaderName = $.trim($('#leaderName').val());
	var leaderTitle = $.trim($('#leaderTitle').val());
	var leaderTel = $.trim($('#leaderTel').val());
	var contacts = $.trim($('#contacts').val());
	var contactsTel = $.trim($('#contactsTel').val());
	var fax = $.trim($('#fax').val());
	var zip = $.trim($('#zip').val());
	
	if(name==""){
		alert("党组织名称不能为空");
		return;
	}
	if(address==""){
		alert("地址不能为空");
		return;
	}
	if(type==""){
		alert("单位性质不能为空");
		return;
	}
	if(workerNum==""){
		alert("单位员工数不能为空");
		return;
	}else if(isNaN(workerNum)){
		alert("单位员工数必须为数字");
		return;
	}
	if(leaderName==""){
		alert("单位负责人姓名不能为空");
		return;
	}
	if(leaderTitle==""){
		alert("负责人党内职务不能为空");
		return;
	}
	if(leaderTel==""){
		alert("负责人联系方式不能为空");
		return;
	}
	if(contacts==""){
		alert("联系人不能为空");
		return;
	}
	if(contactsTel==""){
		alert("联系人电话不能为空");
		return;
	}
	if(fax==""){
		alert("传真不能为空");
		return;
	}
	if(zip==""){
		alert("邮编不能为空");
		return;
	}
	
	workerNum = parseInt(workerNum);
	var fd = new FormData();
	fd.append('lxParty.timeKey',timeKey);
	fd.append('lxParty.name',name);
	fd.append('lxParty.address',address);
	fd.append('lxParty.type',type);
	fd.append('lxParty.workerNum',workerNum);
	fd.append('lxParty.leaderName',leaderName);
	fd.append('lxParty.leaderTitle',leaderTitle);
	fd.append('lxParty.leaderTel',leaderTel);
	fd.append('lxParty.contacts',contacts);
	fd.append('lxParty.contactsTel',contactsTel);
	fd.append('lxParty.fax',fax);
	fd.append('lxParty.zip',zip);
	
	$.ajax({
	    url:"${pageContext.request.contextPath}/LXPartyAction!updatePartyInfo.action",
	    type:"POST",
	    data:fd,
	    dataType: "json", 
	    contentType: false, //必须
	    processData: false, //必须
	    success:function(data){
	    	alert(data.message);
			if(data.success){
				location.href="/djzx/LXPartyAction!getPartyInfoListForPage.action";
			}
	    }
	}); 
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" align="center" valign="bottom" class="td06"><table width="98%" border="0" cellspacing="3" cellpadding="0">
      <tr>
        <td width="15"><img src="/djzx/images/index_32.gif" width="9" height="9"></td>
        <td valign="bottom" class="title">编辑党组织</td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<input type="hidden" name="timeKey" id="timeKey" value="${lxParty.timeKey }" />
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="120" height="24" class="td_form01">党组织名称</td>
        <td nowrap class=td_form02>
        	<input type="text" name="name" id="name" size="30" value="${lxParty.name }" />
        </td>
        <td width="120" class="td_form01">地址</td>
        <td nowrap class=td_form02>
        	<input type="text" name="address" id="address" size="30" value="${lxParty.address }" />
        </td>
      </tr>
      <tr>
        <td height="24" class="td_form01">单位性质</td>
        <td nowrap class=td_form02>
        	<input type="text" name="type" id="type" size="30" value="${lxParty.type }" />
        </td>
        <td class="td_form01">单位员工数</td>
        <td nowrap class=td_form02>
        	<input type="text" name="workerNum" id="workerNum" size="30" value="${lxParty.workerNum }" />
        </td>
      </tr>
	  <tr>
        <td height="24" class="td_form01">单位负责人姓名</td>
        <td nowrap class=td_form02>
        	<input type="text" name="leaderName" id="leaderName" size="30" value="${lxParty.leaderName }" />
        </td>
        <td class="td_form01">负责人党内职务</td>
        <td nowrap class=td_form02>
        	<input type="text" name="leaderTitle" id="leaderTitle" size="30" value="${lxParty.leaderTitle }" />
        </td>
      </tr>
	  <tr>
		<td class="td_form01">负责人联系方式</td>
        <td nowrap class=td_form02>
        	<input type="text" name="leaderTel" id="leaderTel" size="30" value="${lxParty.leaderTel }" />
        </td>
        <td height="24" class="td_form01">联系人</td>
        <td nowrap class=td_form02>
        	<input type="text" name="contacts" id="contacts" size="30" value="${lxParty.contacts }" />
        </td>
      </tr>
	  <tr>
		<td class="td_form01">联系人电话</td>
        <td nowrap class=td_form02>
        	<input type="text" name="contactsTel" id="contactsTel" size="30" value="${lxParty.contactsTel }" />
        </td>
        <td height="24" class="td_form01">传真</td>
        <td nowrap class=td_form02>
        	<input type="text" name="fax" id="fax" size="30" value="${lxParty.fax }" />
        </td>
      </tr>
	  <tr>
		<td height="24" class="td_form01">邮编</td>
        <td nowrap class=td_form02>
        	<input type="text" name="zip" id="zip" size="30" value="${lxParty.zip }" />
        </td>
      </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><input name="Submit2" type="submit" class="buttonface" value="  保存  " onClick="updateParty()">
    <input name="Submit" type="submit" class="buttonface" value="  返回  "  onClick="goback()"></td>
  </tr>
</table>
<br>
</body>
</html>